package com.itheima.health.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.health.dao.CheckGroupDao;
import com.itheima.health.dao.PermissionDao;
import com.itheima.health.entity.PageResult;
import com.itheima.health.pojo.CheckGroup;
import com.itheima.health.pojo.Permission;
import com.itheima.health.service.CheckGroupService;
import com.itheima.health.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName CheckItemServiceImpl
 * @Description TODO
 * @Author ly
 * @Company 深圳黑马程序员
 * @Date 2019/8/20 16:00
 * @Version V1.0
 */
// dubbo（整合声明式事务处理1：配置applicationContext-tx.xml对类代理，2：@Service(interfaceClass = CheckItemService.class)）
@Service(interfaceClass = PermissionService.class)
@Transactional
public class PermissionServiceImpl implements PermissionService {

    @Autowired
    PermissionDao permissionDao;

<<<<<<< HEAD
    //分页
=======
    @Override
    public PageResult findPage(String queryString, Integer currentPage, Integer pageSize) {
        return null;
    }

    @Override
    public void add(Permission permission) {

    }

    @Override
    public void deleteById(Integer id) {

    }

    @Override
    public Permission findById(Integer id) {
        return null;
    }

    @Override
    public void edit(Permission permission) {

    }


   /* //分页
>>>>>>> adc48831cde55357ef0420c5deac2882fa85ad7a
    @Override
    public PageResult findPage(String queryString, Integer currentPage, Integer pageSize) {
        // PageHelper的分页助手
        // 1：初始化
        PageHelper.startPage(currentPage,pageSize);
        // 2：执行查询
        Page<Permission> page = permissionDao.findPage(queryString);
        // 3：组织结果集
        return new PageResult(page.getTotal(),page.getResult());
    }
    //添加
    @Override
    public void add(Permission permission) {
        //1：新增检查组，向t_checkgroup表新增数据，新增后返回检查组的id
        permissionDao.add(permission);
    }
    //删除
    @Override
    public void deleteById(Integer id) {
        // 使用检查项的id进行删除
        permissionDao.deleteById(id);
    }
    //回显
    @Override
    public Permission findById(Integer id) {
        return permissionDao.findById(id);
    }
    //修改
    @Override
    public void edit(Permission permission) {
        permissionDao.edit(permission);
    }
<<<<<<< HEAD
=======
*/
>>>>>>> adc48831cde55357ef0420c5deac2882fa85ad7a
}
